package com.xiaoshuidi.cloud.module.member.enums.point;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

/**
 * @description: 积分增减类型枚举
 * @author: neil@ixiaoshuidi.com
 * @create: 2022-12-15 15:02
 **/
public enum PointChangeEnums{
    /**
     * 手动
     */
    HAND(0,"手动"),
    /**
     * 自动
     */
    AUTO(1,"自动"),
   ;

    private int value;
    private String msg;

    PointChangeEnums(int value,String msg) {
        this.value = value;
        this.msg = msg;
    }

    public int value() {
        return this.value;
    }

    public String getMsg() {
        return this.msg;
    }

    public static String getMsgByKey(int key) {
        PointChangeEnums[] payArray = values();
        for (PointChangeEnums channelEnum : payArray) {
            if (channelEnum.value() == key) {
                return channelEnum.getMsg();
            }
        }
        return null;
    }

    public static List<HashMap<String,Object>> getList() {
        List<HashMap<String, Object>> list = new ArrayList<>();
        for (PointChangeEnums enums : EnumSet.allOf(PointChangeEnums.class)) {
            HashMap<String, Object> map = new HashMap<>();
            map.put("value",enums.value);
            map.put("msg",enums.msg);
            list.add(map);
        }
        return list;
    }
}
